package WaiBao;

import java.util.Arrays;

public class YangLu {
    public static void main(String[] args) {
        String[] name = {"小海(班长)", "小鹏(副班长)", "小李(学习委员)", "小凯(文艺委员)", "小风(体育委员)", "小李", "小花", "小梦", "小唐", "消沉", "小陈", "小于",
                "小值", "小智", "小锦", "小牧", "小贝", "小乐", "小可", "小红", "小白", "小紫", "小浪", "小天", "小产", "小超", "小进", "小站",
                "小小", "杨璐(学生)"};//考生本人:杨璐(学生)
        int[] age = {21, 19, 20, 20, 20, 18, 20, 18, 19, 20, 20, 18, 18, 20, 21, 20, 18, 19, 18, 20, 19, 19, 20, 20, 20, 17, 18, 19, 20, 20};//考生年龄：20

        double[] wode1 = {81, 85, 85, 81, 76, 68, 74, 89, 80, 71, 74, 87, 85, 74, 74, 78, 69, 91, 90, 85, 72, 91, 75, 88, 70, 74, 75, 68, 91, 83};
        double[] wode2 = {69, 78, 76, 88, 83, 77, 84, 74, 72, 81, 83, 78, 87, 75, 84, 64, 70, 74, 76, 68, 82, 74, 68, 80, 77, 85, 76, 65, 74, 84};
        double[] wode3 = {77, 70, 71, 85, 78, 69, 78, 81, 84, 69, 63, 85, 85, 75, 68, 68, 69, 69, 96, 73, 92, 81, 90, 65, 79, 87, 79, 67, 64, 80};

        double excel1;//代表每个学生的总分
        double excel2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            excel1 = wode1[i] +wode2[i] +wode3[i];
//            excel2 = ( excel1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + excel1);
//            System.out.println(name[i] + "的平均分为:" +excel2);
//        }


        double lele1 = 0,lele2 = 0;
        double[] kaikai = new double[30];
//        for (int i = 0; i < 30; i++) {
//            lele1 = wode1[i] + wode2[i] +wode3[i];
//            lele2 = (lele1 * 1.0) / 3;
//            kaikai[i] = lele2;
//        }
//
//        for (int i = 0; i <kaikai.length - 1; i++) {
//            for (int j = 0; j < kaikai.length - i - 1; j++) {
//                if (kaikai[j] < kaikai[j + 1]) {
//                    double tep = kaikai[j];
//                    kaikai[j] = kaikai[j + 1];
//                    kaikai[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(kaikai[i]);
//        }

        double nvli1 = 0,nvli2 = 0, nvli3 = 0;//计算每门课的平均分
        double qiming1 = 0,qiming2 = 0,qiming3 = 0;//计算每门课标准差
        double tongda1 = 0,tongda2 = 0, tongda3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <wode1.length; i++) {
            sum2+=wode1[i];
        }
        nvli1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+nvli1);
        double Sum = 0;
        for (int i = 0; i <wode2.length; i++) {
            Sum+=wode2[i];
        }
        nvli2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+nvli2);
        double sum = 0;
        for (int i = 0; i <wode3.length; i++) {
            sum+=wode3[i];
        }
        nvli3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+nvli3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <wode1.length; i++) {
            c1+= (wode1[i] -nvli1)*(wode1[i] - nvli1);
        }
        qiming1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+qiming1);

        for (int i = 0; i < wode2.length; i++) {
            c2+= (wode2[i] -nvli2)*(wode2[i] - nvli2);
        }
        qiming2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+qiming2);

        for (int i = 0; i <wode3.length; i++) {
            c3+= (wode3[i] - nvli3)*(wode3[i] - nvli3);
        }
        qiming3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+qiming3);
//////////////
//////////////
        Arrays.sort(wode1);
        Arrays.sort(wode2);
        Arrays.sort(wode3);
        tongda1 =(wode1[14]+wode1[15])*1.0/2;
        tongda2 =(wode2[14]+wode2[15])*1.0/2;
        tongda3 =(wode3[14]+wode3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+tongda1);
        System.out.println("微生物学的中位数为:"+tongda2);
        System.out.println("人体组织解剖学的中位数为:"+tongda3);

    }
}
